<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
</head>
<body>
<form >
    账号：<input id="username" type="text" name="username" /> <br/>
    密码：<input id="password" type="password" name="password"> <br/>
    手机号：<input type="text" name="phone" id="phone" ><br/>
    <input type="button"  id="btn" value="注册"/>
</form>
</body>
<script src="/layui/layui.js" charset="utf-8"></script>
<script>
    layui.use(['jquery','layer'] , function () {
        var $ = layui.jquery
        ,layer = layui.layer ;

        $("#btn").click(function () {
            // 注册操作
            $.ajax({
                url:"/admin/register"
                ,dataType:"json"
                ,data:{'username':$("#username").val() , 'password':$("#password").val() , 'phone': $("#phone").val()}
                ,success: function(data){
                    if (data.code == 200){
                        location.href = "/admin/loginPage"
                    }else{
                        layer.msg(data.msg)
                    }
                }
            })
        })
    })
</script>
</html>